//
//  CircleView.m
//  CADisplayLinkDrawRect
//
//  Created by Xwoder on 17/1/31.
//  Copyright © 2017年 Xwoder. All rights reserved.
//

#import "CircleView.h"

@implementation CircleView

- (void)setRadius:(NSUInteger)radius {
    _radius = radius;
    [self setNeedsDisplay];
}

- (void)drawRect:(CGRect)rect {
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextAddArc(context,
                    rect.size.width / 2, rect.size.height / 2,
                    self.radius,
                    0, M_PI * 2,
                    0);
    CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
    CGContextFillPath(context);
}

@end
